package cn.harry.cabinet.server.dto.common

import kotlinx.serialization.InternalSerializationApi
import kotlinx.serialization.Serializable

/**
 * 通用分页响应DTO
 */
@InternalSerializationApi
@Serializable
data class PaginationResponse<T>(
    val data: List<T>,
    val pagination: PaginationInfo
)

/**
 * 分页信息
 */
@InternalSerializationApi
@Serializable
data class PaginationInfo(
    val page: Int,
    val size: Int,
    val total: Long,
    val totalPages: Long
) {
    companion object {
        /**
         * 创建分页信息
         */
        fun create(page: Int, size: Int, total: Long): PaginationInfo {
            val totalPages = if (total == 0L) 0L else (total + size - 1) / size
            return PaginationInfo(page, size, total, totalPages)
        }
    }
} 